using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_psMap : EntityTypeConfiguration<so_ps>
    {
        public so_psMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Date, t.Master, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Customer__)
                .HasMaxLength(10);

            this.Property(t => t.Customer)
                .HasMaxLength(60);

            this.Property(t => t.Cust_cur)
                .HasMaxLength(5);

            this.Property(t => t.Document_Type)
                .HasMaxLength(16);

            this.Property(t => t.Document_Mode)
                .HasMaxLength(7);

            this.Property(t => t.Number)
                .HasMaxLength(8);

            this.Property(t => t.Doc_cur)
                .HasMaxLength(5);

            this.Property(t => t.Salesman)
                .HasMaxLength(30);

            this.Property(t => t.batch)
                .HasMaxLength(8);

            this.Property(t => t.Master__)
                .HasMaxLength(12);

            this.Property(t => t.Master)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.notes)
                .HasMaxLength(70);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(114);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(21);

            // Table & Column Mappings
            this.ToTable("so_ps");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.Cust_cur).HasColumnName("Cust_cur");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Document_Type).HasColumnName("Document_Type");
            this.Property(t => t.Document_Mode).HasColumnName("Document_Mode");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Doc_cur).HasColumnName("Doc_cur");
            this.Property(t => t.Invoice_bal_Doc_cur).HasColumnName("Invoice_bal_Doc_cur");
            this.Property(t => t.Invoice_bal_cust_cur).HasColumnName("Invoice_bal_cust_cur");
            this.Property(t => t.Invoice_balance_b1).HasColumnName("Invoice_balance_b1");
            this.Property(t => t.Invoice_balance_b2).HasColumnName("Invoice_balance_b2");
            this.Property(t => t.Order_Bal_Doc_cur).HasColumnName("Order_Bal_Doc_cur");
            this.Property(t => t.Order_Bal_cut_cur).HasColumnName("Order_Bal_cut_cur");
            this.Property(t => t.Order_Balance_b1).HasColumnName("Order_Balance_b1");
            this.Property(t => t.Order_Balance_b2).HasColumnName("Order_Balance_b2");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
            this.Property(t => t.salesman__).HasColumnName("salesman_#");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.Master__).HasColumnName("Master_#");
            this.Property(t => t.Master).HasColumnName("Master");
            this.Property(t => t.closed_out).HasColumnName("closed_out");
            this.Property(t => t.notes).HasColumnName("notes");
            this.Property(t => t.Document_id).HasColumnName("Document_id");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
